package com.aaron.client;


public class UnsafeHTTPRequest {
	public static native String getContents(String url)/*-{
		var xml="";
		function wait(millis)
		{
			var date = new Date();
			var curDate = null;

			do { curDate = new Date(); }
				while(curDate-date < millis);
		}
		function successHandler(o){ 
		    xml = o.responseXML.documentElement; 
		} 


		function failureHandler(o){ 
		    alert(o.status + " " + o.statusText); 
		}

		//escalate privledges
		try {
    		    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
   		} catch (e) {
    		    alert("Permission UniversalBrowserRead denied.");
   		}

		var cObj = $wnd.YAHOO.util.Connect.asyncRequest('GET', url,  {success:successHandler, failure:failureHandler }, null);
		while($wnd.YAHOO.util.Connect.isCallInProgress(cObj)){
			this.wait(100);
		}
		return xml;
		
	 }-*/;
}
